home *** CD-ROM | disk | FTP | other *** search
- // Filename: USERCODE.CPP
- // "DIB" Generated by Visual Programmer
- // Author: Blue Sky
-
- //
- // ***********************************************************************
- // Code in this file is initially generated by the Switch-It Module.
- // This file contains functions you can change
- // to provide whatever functionality you require.
- //
- //
- //
- // For more information,
- // see the section "How code is generated" in the documentation.
- //
- // ***********************************************************************
- //
-
- #include "AFXWIN.H"
- #include "DIB.H"
-
- WMPDEBUG
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
-
- #include "USERCODE.WMC"
-
-
- CBitmapInstance CBitInst;
-
-
-
- // *************************************************************
- // Class definition for Class: Cwm_AboutDlg
- // Base Class : Cwm_AboutBaseDlg
- // Derived from MFC Class : CDialog
- // *************************************************************
-
- class Cwm_AboutDlg : public Cwm_AboutBaseDlg
- {
- public:
- Cwm_AboutDlg(LPCSTR lpszTemplateName,CWnd *pParentWnd);
- Cwm_AboutDlg() : Cwm_AboutBaseDlg() {};
-
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
-
- virtual BOOL OnInitDialog();
- virtual void OnOK();
- virtual void OnCancel();
-
- // YOU CAN ADD YOUR OWN CODE HERE
-
-
- protected:
- //{{SIM_MSG_PROTO(Cwm_AboutDlg)
- // DO NOT EDIT what you see in this block of generated code.
- //}}SIM_MSG_PROTO(Cwm_AboutDlg)
-
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
-
- DECLARE_DYNCREATE(Cwm_AboutDlg)
-
- DECLARE_MESSAGE_MAP()
-
- };
-
-
- // *************************************************************
- // C Startup function for modal dialogbox ABOUT
- // *************************************************************
-
- int BLD_AboutDlgFunc(CWnd *pWnd)
- {
- int iRet;
- Cwm_AboutDlg TheDlg ("ABOUT",pWnd);
-
- iRet=TheDlg.DoModal();
- if( -1 == iRet )
- {
- BLDDisplayMessage (::GetActiveWindow (), BLD_CannotCreate,
- "ABOUT", MB_OK | MB_ICONHAND);
- }
- return iRet;
- }
-
-
-
- // *************************************************************
- // Member Functions for Class: Cwm_AboutDlg
- // Base Class : Cwm_AboutBaseDlg
- // Derived from MFC Class : CDialog
- // *************************************************************
-
- Cwm_AboutDlg::Cwm_AboutDlg(LPCSTR lpszTemplateName,CWnd *pParentWnd)
- : Cwm_AboutBaseDlg(lpszTemplateName,pParentWnd)
- {
- }
-
-
-
- BOOL Cwm_AboutDlg::OnInitDialog()
- {
- return Cwm_AboutBaseDlg::OnInitDialog();
- }
-
-
-
-
- void Cwm_AboutDlg::OnOK()
- {
- Cwm_AboutBaseDlg::OnOK();
- }
-
-
-
- void Cwm_AboutDlg::OnCancel()
- {
- Cwm_AboutBaseDlg::OnCancel();
- }
-
-
- IMPLEMENT_DYNCREATE(Cwm_AboutDlg, Cwm_AboutBaseDlg)
-
- BEGIN_MESSAGE_MAP(Cwm_AboutDlg, Cwm_AboutBaseDlg)
-
- // YOU CAN ADD YOUR OWN CODE HERE
-
- //{{SIM_MSG_MAP(Cwm_AboutDlg)
- // DO NOT EDIT what you see in this block of generated code.
- //}}SIM_MSG_MAP(Cwm_AboutDlg)
-
- END_MESSAGE_MAP()
-
-
- //{{SIM_MSG_BODY(Cwm_AboutDlg)
- // Message Handler Functions for you to edit will come here.
-
-
- //}}SIM_MSG_BODY(Cwm_AboutDlg)
-
-
-
- void Cwm_AboutDlg::DoDataExchange(CDataExchange* pDX)
- {
- Cwm_AboutBaseDlg::DoDataExchange(pDX);
-
- // YOU CAN ADD YOUR OWN CODE HERE
-
-
- //{{SIM_DATA_MAP(Cwm_AboutDlg)
- // DO NOT EDIT what you see in this block of generated code.
-
- //}}SIM_DATA_MAP
- }
-
-
-
- // *************************************************************
- // Cwm_AboutDlg diagnostics
-
- #ifdef _DEBUG
- void Cwm_AboutDlg::AssertValid() const
- {
- Cwm_AboutBaseDlg::AssertValid();
- }
-
- void Cwm_AboutDlg::Dump(CDumpContext& dc) const
- {
- Cwm_AboutBaseDlg::Dump(dc);
- }
-
- #endif //_DEBUG
-
-
-
- // User Defined Code
- BOOL BLD_RedUDCFunc(CWnd *pWnd)
- {
- CBitInst.SwitchBMP(IDM_Red,"RED.DLL");
- return TRUE;
- }
-
-
- // User Defined Code
- BOOL BLD_BlueUDCFunc(CWnd *pWnd)
- {
- CBitInst.SwitchBMP(IDM_Blue,"BLUE.DLL");
- return TRUE;
- }
-
-
- // User Defined Code
- BOOL BLD_OwnUDCFunc(CWnd *pWnd)
- {
- CBitInst.SwitchBMP(IDM_Own,NULL);
- return TRUE;
- }
-
-
- // *************************************************************
- // Class definition for Class: Cwm_DIBClientDlg
- // Base Class : Cwm_DIBClientBaseDlg
- // Derived from MFC Class : CFormView
- // *************************************************************
-
- class Cwm_DIBClientDlg : public Cwm_DIBClientBaseDlg
- {
- public:
- Cwm_DIBClientDlg(LPCSTR lpszTemplateName);
- Cwm_DIBClientDlg() : Cwm_DIBClientBaseDlg() {};
-
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
-
- virtual BOOL OnInitDialog();
-
- // YOU CAN ADD YOUR OWN CODE HERE
-
-
- protected:
- //{{SIM_MSG_PROTO(Cwm_DIBClientDlg)
- // DO NOT EDIT what you see in this block of generated code.
- //}}SIM_MSG_PROTO(Cwm_DIBClientDlg)
-
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
-
- DECLARE_DYNCREATE(Cwm_DIBClientDlg)
-
- DECLARE_MESSAGE_MAP()
-
- };
-
-
- // *************************************************************
- // C Startup function client area controls CLIENT
- // *************************************************************
-
- CWnd* BLD_DIBClientClFunc (CWnd* pWnd)
- {
- Cwm_DIBClientDlg* pTheClientDlg;
- pTheClientDlg = new Cwm_DIBClientDlg("CLIENT");
- if(!pTheClientDlg->Create(pWnd))
- {
- BLDDisplayMessage (::GetActiveWindow (), BLD_CannotCreate,
- "CLIENT", MB_OK | MB_ICONHAND);
- return NULL;
- }
- return pTheClientDlg;
- }
-
-
-
- // *************************************************************
- // Member Functions for Class: Cwm_DIBClientDlg
- // Base Class : Cwm_DIBClientBaseDlg
- // Derived from MFC Class : CFormView
- // *************************************************************
-
- Cwm_DIBClientDlg::Cwm_DIBClientDlg(LPCSTR lpszTemplateName)
- : Cwm_DIBClientBaseDlg(lpszTemplateName)
- {
- }
-
-
-
- BOOL Cwm_DIBClientDlg::OnInitDialog()
- {
- return Cwm_DIBClientBaseDlg::OnInitDialog();
- }
-
-
- IMPLEMENT_DYNCREATE(Cwm_DIBClientDlg, Cwm_DIBClientBaseDlg)
-
- BEGIN_MESSAGE_MAP(Cwm_DIBClientDlg, Cwm_DIBClientBaseDlg)
-
- // YOU CAN ADD YOUR OWN CODE HERE
-
- //{{SIM_MSG_MAP(Cwm_DIBClientDlg)
- // DO NOT EDIT what you see in this block of generated code.
- //}}SIM_MSG_MAP(Cwm_DIBClientDlg)
-
- END_MESSAGE_MAP()
-
-
- //{{SIM_MSG_BODY(Cwm_DIBClientDlg)
- // Message Handler Functions for you to edit will come here.
-
-
- //}}SIM_MSG_BODY(Cwm_DIBClientDlg)
-
-
-
- void Cwm_DIBClientDlg::DoDataExchange(CDataExchange* pDX)
- {
- Cwm_DIBClientBaseDlg::DoDataExchange(pDX);
-
- // YOU CAN ADD YOUR OWN CODE HERE
-
-
- //{{SIM_DATA_MAP(Cwm_DIBClientDlg)
- // DO NOT EDIT what you see in this block of generated code.
-
- //}}SIM_DATA_MAP
- }
-
-
-
- // *************************************************************
- // Cwm_DIBClientDlg diagnostics
-
- #ifdef _DEBUG
- void Cwm_DIBClientDlg::AssertValid() const
- {
- Cwm_DIBClientBaseDlg::AssertValid();
- }
-
- void Cwm_DIBClientDlg::Dump(CDumpContext& dc) const
- {
- Cwm_DIBClientBaseDlg::Dump(dc);
- }
-
- #endif //_DEBUG
-
-
-
- // ****************************************************************************
- // Member functions for CBitmapInstance
- // ****************************************************************************
-
- // Constructor
- CBitmapInstance::CBitmapInstance()
- {
- hBMPLib = 0;
- iLastCheck = IDM_Own;
- }
-
-
- BOOL CBitmapInstance::SwitchBMP(int iMenuId,char *pDLL)
- {
- HINSTANCE hNewLib;
- char path[256];
- CMenu * pMenu;
- char *pStr;
-
- if (!pDLL)
- hNewLib = 0; // Use own BMPs
- else
- {
- if (!::GetModuleFileName(AfxGetInstanceHandle(),path,sizeof(path)))
- return FALSE;
- pStr = strrchr(path,'\\');
- if (!pStr)
- return FALSE;
- pStr++;
- lstrcpy(pStr,pDLL);
- hNewLib = LoadLibrary(path);
- if (hNewLib<HINSTANCE_ERROR)
- return FALSE; // Couldn't load DLL use previous setting
- }
-
- if (hBMPLib)
- FreeLibrary(hBMPLib);
- hBMPLib = hNewLib;
- // hBMPInst is used by MFC SIM functions to load bitmaps
- if (hNewLib)
- hBMPInst= hNewLib;
- else
- hBMPInst= 0;
- if (!TheApp.m_pMainWnd)
- return FALSE;
- TheApp.m_pMainWnd->InvalidateRect(NULL,FALSE);
- pMenu = TheApp.m_pMainWnd->GetMenu();
- if (!pMenu)
- return FALSE;
- pMenu->CheckMenuItem(iLastCheck,MF_BYCOMMAND|MF_UNCHECKED);
- pMenu->CheckMenuItem(iMenuId,MF_BYCOMMAND|MF_CHECKED);
- iLastCheck = iMenuId;
- return TRUE;
- }
-
-
- BOOL CBitmapInstance::FreeLib()
- {
- if (hBMPLib)
- FreeLibrary(hBMPLib);
- hBMPLib = 0;
- return TRUE;
- }
-